package com.pignest.hotel.spring;

import javax.servlet.ServletContextEvent;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.pignest.framework.util.Log;

public class ContextLoaderListener extends org.springframework.web.context.ContextLoaderListener {

	@Override
	public void contextInitialized(ServletContextEvent event) {
		super.contextInitialized(event);
		ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
		ContextHolder.setApplicationContext(context);
		ContextHolder.setContextPath(event.getServletContext().getContextPath());
		ContextHolder.setRealPath(event.getServletContext().getRealPath("/"));
		Log.e(ContextHolder.getContextPath());
	}
	
//	@Override
//	public void contextDestroyed(ServletContextEvent event) {
//		super.contextDestroyed(event);
//	}
	
}
